<?php

namespace app\v1\controller;

use app\v1\logic\MiniUserLogic;
use think\response\Json;

class MiniUser extends BaseController
{
    public function login(): Json
    {
        [$res, $msgOrData] = (new MiniUserLogic())->login($this->param);
        if (!$res) return errorReturn(4001, $msgOrData);
        return successReturn($msgOrData);
    }

    public function saveInfo(): Json
    {
        [$res, $msgOrData] = (new MiniUserLogic())->saveInfo($this->param, $this->userId);
        if (!$res) return errorReturn(4001, $msgOrData);
        return successReturn($msgOrData);
    }

    public function getUserInfo(): Json
    {
        $res = (new MiniUserLogic())->getUserInfo($this->userId);
        return successReturn($res);
    }
}